using System;
using System.Collections.Generic;
namespace MicroMsg.UI.ImageFilter
{
	internal class FilterMethod
	{
		private const int BAR_SIZE = 16;
		private const int BAR_NUM = 256;
		private static short[][] g_mapper_rgb = new short[3][];
		private static short[][] g_mapper_rgb2 = new short[3][];
		private static byte Normal(int int_0, int mask, int rate)
		{
			return FilterMethod.norm((int_0 * (100 - rate) + mask * rate) / 100);
		}
		private static byte Overlay(int int_0, int mask, int rate)
		{
			int num;
			if (int_0 <= 128)
			{
				num = int_0 * mask >> 7;
			}
			else
			{
				num = 255 - ((255 - int_0) * (255 - mask) >> 7);
			}
			return FilterMethod.norm((int_0 * (100 - rate) + num * rate) / 100);
		}
		private static byte Overlay(int int_0, int mask)
		{
			int int_;
			if (int_0 <= 128)
			{
				int_ = int_0 * mask >> 7;
			}
			else
			{
				int_ = 255 - ((255 - int_0) * (255 - mask) >> 7);
			}
			return FilterMethod.norm(int_);
		}
		private static byte Multiply(int int_0, int mask, int rate)
		{
			int num = int_0 * mask >> 8;
			return (byte)((int_0 * (100 - rate) + num * rate) / 100);
		}
		private static byte Multiply(int int_0, int mask)
		{
			return (byte)(int_0 * mask >> 8);
		}
		private static byte Screen(int int_0, int mask, int rate)
		{
			int num = 255 - ((255 - int_0) * (255 - mask) >> 8);
			return FilterMethod.norm((int_0 * (100 - rate) + num * rate) / 100);
		}
		private static byte Screen(int int_0, int mask, int rate, int usealpha)
		{
			return FilterMethod.norm((int_0 * (255 - rate) + mask * rate) / 255);
		}
		private static byte Screen(int int_0, int mask)
		{
			return (byte)(255 - ((255 - int_0) * (255 - mask) >> 8));
		}
		private static byte ColorDodge(int int_0, int mask, int rate)
		{
			int num = (int)((double)int_0 * 255.0 / (double)(256 - mask));
			return FilterMethod.norm((int_0 * (100 - rate) + num * rate) / 100);
		}
		private static byte ColorDodge(int int_0, int mask)
		{
			int int_ = int_0 * 255 / (256 - mask);
			return FilterMethod.norm(int_);
		}
		private static byte ColorBurn(int int_0, int mask)
		{
			int int_;
			if (mask != 0)
			{
				int_ = 255 - 255 * (255 - int_0) / mask;
			}
			else
			{
				int_ = 0;
			}
			return FilterMethod.norm(int_);
		}
		private static byte LinearBurn(int int_0, int mask, int rate)
		{
			int num = int_0 + mask - 256;
			return FilterMethod.norm((int_0 * (100 - rate) + num * rate) / 100);
		}
		private static byte gray(byte[] byte_0)
		{
			int int_ = (int)((byte_0[0] * 30 + byte_0[1] * 59 + byte_0[2] * 11) / 100);
			return FilterMethod.norm(int_);
		}
		private static byte Exclusion(int int_0, int mask)
		{
			int int_ = int_0 + mask - (int_0 * mask >> 7);
			return FilterMethod.norm(int_);
		}
		private static byte Reverse(byte byte_0)
		{
			return ~byte_0;
		}
		private static byte norm(int int_0)
		{
			if (int_0 < 0)
			{
				return 0;
			}
			if (int_0 > 255)
			{
				return 255;
			}
			return (byte)(int_0 & 255);
		}
		private static int norm_16(int int_0)
		{
			if (int_0 < 0)
			{
				return 0;
			}
			if (int_0 > 65535)
			{
				return 65535;
			}
			return int_0 & 65535;
		}
		private static void overlay_vv(byte[,] byte_0, byte[,] mask, int length)
		{
			for (int i = 0; i < length; i++)
			{
				int num = FilterMethod.norm_16((int)byte_0[i, 0] + ((int)mask[i, 2] << 1) - (byte_0[i, 0] * mask[i, 2] >> 7) - 128);
				num = (int)FilterMethod.norm((int)byte_0[i, 0] * num >> 7);
				byte_0[i, 0] = (byte)(num + (int)byte_0[i, 0] >> 1);
				num = FilterMethod.norm_16((int)byte_0[i, 1] + ((int)mask[i, 1] << 1) - (byte_0[i, 1] * mask[i, 1] >> 7) - 128);
				num = (int)FilterMethod.norm((int)byte_0[i, 1] * num >> 7);
				byte_0[i, 1] = (byte)(num + (int)byte_0[i, 1] >> 1);
				num = FilterMethod.norm_16((int)byte_0[i, 2] + ((int)mask[i, 0] << 1) - (byte_0[i, 2] * mask[i, 0] >> 7) - 128);
				num = (int)FilterMethod.norm((int)byte_0[i, 2] * num >> 7);
				byte_0[i, 2] = (byte)(num + (int)byte_0[i, 2] >> 1);
			}
		}
		private static void overlay_vvr(byte[,] byte_0, byte[,] mask, int rate, int length)
		{
			int num = 128 - rate;
			for (int i = 0; i < length; i++)
			{
				int num2 = FilterMethod.norm_16((int)byte_0[i, 0] + ((int)mask[i, 2] << 1) - (byte_0[i, 0] * mask[i, 2] >> 7) - 128);
				num2 = (int)FilterMethod.norm((int)byte_0[i, 0] * num2 >> 7);
				byte_0[i, 0] = (byte)(num2 * rate + (int)byte_0[i, 0] * num >> 7);
				num2 = FilterMethod.norm_16((int)byte_0[i, 1] + ((int)mask[i, 1] << 1) - (byte_0[i, 1] * mask[i, 1] >> 7) - 128);
				num2 = (int)FilterMethod.norm((int)byte_0[i, 1] * num2 >> 7);
				byte_0[i, 1] = (byte)(num2 * rate + (int)byte_0[i, 1] * num >> 7);
				num2 = FilterMethod.norm_16((int)byte_0[i, 2] + ((int)mask[i, 0] << 1) - (byte_0[i, 2] * mask[i, 0] >> 7) - 128);
				num2 = (int)FilterMethod.norm((int)byte_0[i, 2] * num2 >> 7);
				byte_0[i, 2] = (byte)(num2 * rate + (int)byte_0[i, 2] * num >> 7);
			}
		}
		private static void overlay_vsr(byte[,] byte_0, byte[] mask, int rate, int length)
		{
			int num = 128 - rate;
			for (int i = 0; i < length; i++)
			{
				int num2 = FilterMethod.norm_16((int)byte_0[i, 0] + ((int)mask[2] << 1) - (byte_0[i, 0] * mask[2] >> 7) - 128);
				num2 = (int)FilterMethod.norm((int)byte_0[i, 0] * num2 >> 7);
				byte_0[i, 0] = (byte)(num2 * rate + (int)byte_0[i, 0] * num >> 7);
				num2 = FilterMethod.norm_16((int)byte_0[i, 1] + ((int)mask[1] << 1) - (byte_0[i, 1] * mask[1] >> 7) - 128);
				num2 = (int)FilterMethod.norm((int)byte_0[i, 1] * num2 >> 7);
				byte_0[i, 1] = (byte)(num2 * rate + (int)byte_0[i, 1] * num >> 7);
				num2 = FilterMethod.norm_16((int)byte_0[i, 2] + ((int)mask[0] << 1) - (byte_0[i, 2] * mask[0] >> 7) - 128);
				num2 = (int)FilterMethod.norm((int)byte_0[i, 2] * num2 >> 7);
				byte_0[i, 2] = (byte)(num2 * rate + (int)byte_0[i, 2] * num >> 7);
			}
		}
		private static void multiply_vv(byte[,] byte_0, byte[,] mask, int length)
		{
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte)(byte_0[i, 0] * mask[i, 2] >> 8);
				byte_0[i, 1] = (byte)(byte_0[i, 1] * mask[i, 1] >> 8);
				byte_0[i, 2] = (byte)(byte_0[i, 2] * mask[i, 0] >> 8);
			}
		}
		private static void multiply_vvr(byte[,] byte_0, byte[,] mask, int rate, int length)
		{
			int num = 128 - rate;
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte)((byte_0[i, 0] * mask[i, 2] >> 8) * rate + (int)byte_0[i, 0] * num >> 7);
				byte_0[i, 1] = (byte)((byte_0[i, 1] * mask[i, 1] >> 8) * rate + (int)byte_0[i, 1] * num >> 7);
				byte_0[i, 2] = (byte)((byte_0[i, 2] * mask[i, 0] >> 8) * rate + (int)byte_0[i, 2] * num >> 7);
			}
		}
		private static void multiply_vs(byte[,] byte_0, byte[,] mask, int length)
		{
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte)(byte_0[i, 0] * mask[0, 2] >> 8);
				byte_0[i, 1] = (byte)(byte_0[i, 1] * mask[0, 1] >> 8);
				byte_0[i, 2] = (byte)(byte_0[i, 2] * mask[0, 0] >> 8);
			}
		}
		private static void Screen_vv(byte[,] byte_0, byte[,] mask, int length)
		{
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte)(255 - ((255 - byte_0[i, 0]) * (255 - mask[i, 2]) >> 8));
				byte_0[i, 1] = (byte)(255 - ((255 - byte_0[i, 1]) * (255 - mask[i, 1]) >> 8));
				byte_0[i, 2] = (byte)(255 - ((255 - byte_0[i, 2]) * (255 - mask[i, 0]) >> 8));
			}
		}
		private static void Screen_vva(byte[,] byte_0, byte[,] mask, int length)
		{
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte)(byte_0[i, 0] * (255 - mask[i, 3]) + mask[i, 2] * mask[i, 3] + 128 >> 8);
				byte_0[i, 1] = (byte)(byte_0[i, 1] * (255 - mask[i, 3]) + mask[i, 1] * mask[i, 3] + 128 >> 8);
				byte_0[i, 2] = (byte)(byte_0[i, 2] * (255 - mask[i, 3]) + mask[i, 0] * mask[i, 3] + 128 >> 8);
			}
		}
		private static void Screen_vsr(byte[,] byte_0, byte[] mask, int rate, int length)
		{
			int num = 128 - rate;
			for (int i = 0; i < length; i++)
			{
				int num2 = 255 - ((255 - byte_0[i, 0]) * (255 - mask[2]) >> 8);
				byte_0[i, 0] = (byte)((int)byte_0[i, 0] * num + num2 * rate >> 7);
				num2 = 255 - ((255 - byte_0[i, 1]) * (255 - mask[1]) >> 8);
				byte_0[i, 1] = (byte)((int)byte_0[i, 1] * num + num2 * rate >> 7);
				num2 = 255 - ((255 - byte_0[i, 2]) * (255 - mask[0]) >> 8);
				byte_0[i, 2] = (byte)((int)byte_0[i, 2] * num + num2 * rate >> 7);
			}
		}
		private static void gray_v(byte[,] byte_0, int length)
		{
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte_0[i, 1] = (byte_0[i, 2] = (byte)(byte_0[i, 0] * 77 + byte_0[i, 1] * 151 + byte_0[i, 2] * 28 + 128 >> 8)));
			}
		}
		private static void gray_rb(byte[,] byte_0, int rate, int length)
		{
			int num = 128 - rate;
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte_0[i, 1] = (byte_0[i, 2] = (byte)(num * (int)byte_0[i, 2] + rate * (int)byte_0[i, 0] >> 7)));
			}
		}
		private static void ColorBurn_vv(byte[,] byte_0, byte[,] mask, int length)
		{
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = FilterMethod.norm(255 - FilterMethod.norm_16((255 - byte_0[i, 0]) * mask[i, 0] + 128 >> 8));
				byte_0[i, 1] = FilterMethod.norm(255 - FilterMethod.norm_16((255 - byte_0[i, 1]) * mask[i, 1] + 128 >> 8));
				byte_0[i, 2] = FilterMethod.norm(255 - FilterMethod.norm_16((255 - byte_0[i, 2]) * mask[i, 2] + 128 >> 8));
			}
		}
		private static void Normal_vvr(byte[,] srcOri, byte[,] byte_0, int rate, int length)
		{
			int num = 128 - rate;
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte)((int)srcOri[i, 0] * num + (int)byte_0[i, 0] * rate >> 7);
				byte_0[i, 1] = (byte)((int)srcOri[i, 1] * num + (int)byte_0[i, 1] * rate >> 7);
				byte_0[i, 2] = (byte)((int)srcOri[i, 2] * num + (int)byte_0[i, 2] * rate >> 7);
			}
		}
		private static void Exclusion_vs(byte[,] byte_0, byte[] mask, int length)
		{
			for (int i = 0; i < length; i++)
			{
				byte_0[i, 0] = (byte)((int)(byte_0[i, 0] + mask[2]) - (byte_0[i, 0] * mask[2] >> 7));
				byte_0[i, 1] = (byte)((int)(byte_0[i, 1] + mask[1]) - (byte_0[i, 1] * mask[1] >> 7));
				byte_0[i, 2] = (byte)((int)(byte_0[i, 2] + mask[0]) - (byte_0[i, 2] * mask[0] >> 7));
			}
		}
		private static void LinearBurn_vvr(byte[,] byte_0, byte[,] mask, int rate, int length)
		{
			int num = 128 - rate;
			for (int i = 0; i < length; i++)
			{
				int num2 = (int)(byte_0[i, 0] + mask[i, 2] - 255);
				byte_0[i, 0] = (byte)((int)byte_0[i, 0] * num + num2 * rate >> 7);
				num2 = (int)(byte_0[i, 1] + mask[i, 1] - 255);
				byte_0[i, 1] = (byte)((int)byte_0[i, 1] * num + num2 * rate >> 7);
				num2 = (int)(byte_0[i, 2] + mask[i, 0] - 255);
				byte_0[i, 2] = (byte)((int)byte_0[i, 2] * num + num2 * rate >> 7);
			}
		}
		private static void memcpy_vv(byte[,] byte_0, byte[,] byte_1, int length)
		{
			byte_0.CopyTo(byte_1, 0);
		}
		private static void MakeMapper(short[] mappoint, short[] mapper)
		{
			for (int i = 0; i < 256; i++)
			{
				int num = i / 16;
				if (num == 15)
				{
					mapper[i] = mappoint[num];
				}
				else
				{
					mapper[i] = (short)((int)mappoint[num] + (int)(mappoint[num + 1] - mappoint[num]) * (i - num * 16) / 16);
				}
			}
		}
		private static void initColorMask(byte[] colorMask, byte[] rgba)
		{
			for (int i = 0; i < 4; i++)
			{
				colorMask[i] = rgba[i];
			}
		}
		public static void LOMO(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					0,
					26,
					55,
					81,
					106,
					127,
					143,
					156,
					164,
					171,
					179,
					189,
					201,
					215,
					228,
					243
				},
				new short[]
				{
					0,
					11,
					25,
					44,
					72,
					106,
					139,
					166,
					183,
					196,
					205,
					213,
					221,
					228,
					237,
					247
				},
				new short[]
				{
					0,
					5,
					11,
					19,
					33,
					53,
					82,
					118,
					159,
					194,
					219,
					234,
					243,
					248,
					251,
					254
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
			}
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
			FilterMethod.overlay_vv(byte_0, masks.get_Item(0), length);
			FilterMethod.overlay_vv(byte_0, masks.get_Item(1), length);
		}
		public static void Glossy(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					0,
					31,
					62,
					91,
					118,
					143,
					165,
					184,
					200,
					213,
					224,
					233,
					239,
					244,
					249,
					252
				},
				new short[]
				{
					0,
					31,
					62,
					91,
					118,
					143,
					165,
					184,
					200,
					213,
					224,
					233,
					239,
					244,
					249,
					252
				},
				new short[]
				{
					0,
					31,
					62,
					91,
					118,
					143,
					165,
					184,
					200,
					213,
					224,
					233,
					239,
					244,
					249,
					252
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
			}
			byte[] array2 = new byte[4];
			byte[] rgba = new byte[]
			{
				48,
				2,
				201,
				255
			};
			FilterMethod.initColorMask(array2, rgba);
			FilterMethod.Screen_vsr(byte_0, array2, 102, length);
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
			FilterMethod.multiply_vvr(byte_0, masks.get_Item(0), 109, length);
		}
		public static void Twilight(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					41,
					48,
					57,
					65,
					72,
					79,
					86,
					91,
					96,
					104,
					109,
					115,
					122,
					132,
					143,
					154
				},
				new short[]
				{
					4,
					10,
					20,
					34,
					52,
					73,
					94,
					117,
					139,
					157,
					177,
					192,
					204,
					214,
					223,
					229
				},
				new short[]
				{
					23,
					41,
					63,
					87,
					115,
					139,
					163,
					185,
					204,
					219,
					230,
					238,
					244,
					247,
					250,
					252
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
			}
			FilterMethod.Screen_vv(byte_0, masks.get_Item(0), length);
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
		}
		public static void Aquatint(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					0,
					0,
					0,
					0,
					0,
					0,
					0,
					0,
					0,
					17,
					37,
					59,
					84,
					105,
					127,
					149
				},
				new short[]
				{
					0,
					0,
					0,
					0,
					0,
					0,
					0,
					0,
					14,
					67,
					132,
					196,
					248,
					255,
					255,
					255
				},
				new short[]
				{
					0,
					0,
					0,
					0,
					3,
					40,
					75,
					105,
					136,
					167,
					200,
					239,
					255,
					255,
					255,
					255
				}
			};
			short[][] array2 = new short[][]
			{
				new short[]
				{
					18,
					34,
					49,
					64,
					79,
					94,
					108,
					121,
					133,
					144,
					155,
					164,
					172,
					178,
					184,
					189
				},
				new short[]
				{
					16,
					36,
					56,
					76,
					95,
					114,
					132,
					149,
					165,
					181,
					194,
					207,
					217,
					226,
					234,
					240
				},
				new short[]
				{
					56,
					73,
					91,
					108,
					125,
					141,
					156,
					170,
					184,
					196,
					207,
					217,
					225,
					232,
					239,
					245
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
				FilterMethod.g_mapper_rgb2[i] = null;
				FilterMethod.g_mapper_rgb2[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
				FilterMethod.MakeMapper(array2[j], FilterMethod.g_mapper_rgb2[j]);
			}
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
			FilterMethod.gray_rb(byte_0, 26, length);
			for (int l = 0; l < length; l++)
			{
				byte_0[l, 0] = (byte)FilterMethod.g_mapper_rgb2[0][(int)byte_0[l, 0]];
				byte_0[l, 1] = (byte)FilterMethod.g_mapper_rgb2[1][(int)byte_0[l, 1]];
				byte_0[l, 2] = (byte)FilterMethod.g_mapper_rgb2[2][(int)byte_0[l, 2]];
			}
		}
		public static void Poster(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					0,
					0,
					0,
					0,
					0,
					0,
					0,
					0,
					0,
					19,
					55,
					86,
					116,
					145,
					167,
					194
				},
				new short[]
				{
					0,
					0,
					0,
					0,
					0,
					217,
					255,
					255,
					255,
					255,
					255,
					255,
					255,
					255,
					255,
					255
				},
				new short[]
				{
					0,
					0,
					0,
					1,
					35,
					177,
					255,
					255,
					255,
					255,
					255,
					255,
					255,
					255,
					255,
					255
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
			}
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
		}
		public static void Pen(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					0,
					11,
					24,
					45,
					76,
					114,
					148,
					167,
					171,
					161,
					143,
					113,
					80,
					77,
					77,
					77
				},
				new short[]
				{
					0,
					12,
					38,
					86,
					143,
					191,
					222,
					236,
					240,
					241,
					239,
					235,
					235,
					235,
					235,
					235
				},
				new short[]
				{
					0,
					74,
					140,
					187,
					219,
					236,
					246,
					250,
					253,
					254,
					255,
					255,
					255,
					255,
					255,
					255
				}
			};
			short[][] array2 = new short[][]
			{
				new short[]
				{
					0,
					102,
					169,
					193,
					202,
					205,
					203,
					196,
					188,
					179,
					172,
					166,
					165,
					168,
					175,
					185
				},
				new short[]
				{
					0,
					65,
					104,
					123,
					137,
					151,
					163,
					174,
					185,
					194,
					203,
					211,
					219,
					227,
					233,
					239
				},
				new short[]
				{
					0,
					10,
					37,
					64,
					89,
					112,
					135,
					156,
					174,
					191,
					205,
					217,
					226,
					234,
					241,
					246
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
				FilterMethod.g_mapper_rgb2[i] = null;
				FilterMethod.g_mapper_rgb2[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
				FilterMethod.MakeMapper(array2[j], FilterMethod.g_mapper_rgb2[j]);
			}
			FilterMethod.multiply_vv(byte_0, masks.get_Item(0), length);
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
			FilterMethod.gray_rb(byte_0, 26, length);
			for (int l = 0; l < length; l++)
			{
				byte_0[l, 0] = (byte)FilterMethod.g_mapper_rgb2[0][(int)byte_0[l, 0]];
				byte_0[l, 1] = (byte)FilterMethod.g_mapper_rgb2[1][(int)byte_0[l, 1]];
				byte_0[l, 2] = (byte)FilterMethod.g_mapper_rgb2[2][(int)byte_0[l, 2]];
			}
		}
		public static void BlackWhite(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					3,
					7,
					10,
					14,
					20,
					27,
					39,
					57,
					80,
					107,
					138,
					165,
					189,
					208,
					221,
					232
				},
				new short[]
				{
					14,
					18,
					24,
					33,
					48,
					68,
					92,
					122,
					152,
					181,
					207,
					227,
					241,
					248,
					252,
					254
				},
				new short[]
				{
					6,
					10,
					15,
					23,
					37,
					61,
					92,
					128,
					165,
					197,
					223,
					239,
					247,
					251,
					252,
					253
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
			}
			FilterMethod.overlay_vvr(byte_0, masks.get_Item(0), 102, length);
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
			FilterMethod.gray_v(byte_0, length);
		}
		public static void Lake(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					46,
					55,
					65,
					78,
					92,
					108,
					127,
					146,
					169,
					191,
					212,
					231,
					244,
					251,
					255,
					255
				},
				new short[]
				{
					20,
					25,
					31,
					42,
					58,
					82,
					112,
					146,
					179,
					210,
					233,
					246,
					252,
					254,
					255,
					255
				},
				new short[]
				{
					3,
					8,
					14,
					25,
					43,
					70,
					104,
					142,
					179,
					208,
					231,
					243,
					250,
					253,
					255,
					255
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
			}
			FilterMethod.LinearBurn_vvr(byte_0, masks.get_Item(0), 0, length);
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
		}
		public static void Wheat(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					97,
					100,
					103,
					108,
					114,
					121,
					129,
					137,
					145,
					154,
					164,
					175,
					183,
					193,
					203,
					212
				},
				new short[]
				{
					43,
					52,
					61,
					71,
					85,
					99,
					114,
					134,
					153,
					173,
					192,
					210,
					227,
					240,
					248,
					253
				},
				new short[]
				{
					35,
					51,
					70,
					89,
					110,
					129,
					150,
					168,
					185,
					202,
					215,
					226,
					237,
					244,
					249,
					252
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
			}
			FilterMethod.LinearBurn_vvr(byte_0, masks.get_Item(0), 0, length);
			FilterMethod.overlay_vv(byte_0, masks.get_Item(1), length);
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
		}
		public static void Polaroid(byte[,] byte_0, List<byte[,]> masks, int length)
		{
			short[][] array = new short[][]
			{
				new short[]
				{
					61,
					66,
					72,
					79,
					88,
					99,
					111,
					125,
					141,
					157,
					176,
					194,
					210,
					221,
					227,
					231
				},
				new short[]
				{
					43,
					44,
					49,
					61,
					80,
					101,
					124,
					145,
					165,
					184,
					200,
					213,
					222,
					230,
					238,
					247
				},
				new short[]
				{
					31,
					37,
					45,
					50,
					57,
					70,
					89,
					116,
					150,
					181,
					208,
					225,
					233,
					236,
					240,
					246
				}
			};
			for (int i = 0; i < 3; i++)
			{
				FilterMethod.g_mapper_rgb[i] = null;
				FilterMethod.g_mapper_rgb[i] = new short[256];
			}
			for (int j = 0; j < 3; j++)
			{
				FilterMethod.MakeMapper(array[j], FilterMethod.g_mapper_rgb[j]);
			}
			FilterMethod.overlay_vvr(byte_0, masks.get_Item(0), 64, length);
			FilterMethod.LinearBurn_vvr(byte_0, masks.get_Item(1), 0, length);
			for (int k = 0; k < length; k++)
			{
				byte_0[k, 0] = (byte)FilterMethod.g_mapper_rgb[0][(int)byte_0[k, 0]];
				byte_0[k, 1] = (byte)FilterMethod.g_mapper_rgb[1][(int)byte_0[k, 1]];
				byte_0[k, 2] = (byte)FilterMethod.g_mapper_rgb[2][(int)byte_0[k, 2]];
			}
		}
	}
}
